//
//  NWJSONParser.m
//  vovo
//
//  Created by wzd on 14-3-19.
//  Copyright (c) 2014年 xinwei. All rights reserved.
//

#import "NWJSONParser.h"
//#import "JSONKit.h"
@implementation NWJSONParser


+(id)jsonFormat:(id)obj
{
    if ([obj isKindOfClass:[NSDictionary class]]) {
        obj=[[NSMutableDictionary alloc] initWithDictionary:obj];
    }
    if ([obj isKindOfClass:[NSArray class]]) {
        obj=[[NSMutableArray alloc] initWithArray:obj];
    }

   // NSLog(@"------------------%@",obj);
    if ([obj isKindOfClass:[NSMutableDictionary class]]) {
        for (NSString *key in [obj allKeys])
        {
            [obj setObject:[self jsonFormat:[obj objectForKey:key]] forKey:key];
        }
    }
    else if([obj isKindOfClass:[NSMutableArray class]])
    {
        for (int i = 0; i < [obj count]; i++)
        {
            obj[i] =  [self jsonFormat:obj[i]];
        }
    }
    else if (!obj || [(NSNull *)obj isKindOfClass:[NSNull class]]||obj==nil)
    {
        return @"";
    }
    return obj;
}

+(NSMutableArray*)arrayparserjson:(id)jsonobc{
    return [self jsonFormat:jsonobc];
}
+(NSMutableDictionary*)parserjson:(id)jsonobc{
  return [self jsonFormat:jsonobc];
}
+(BOOL)isEnableData:(id)data
{
    if ([data isKindOfClass:[NSArray class]] || [data isKindOfClass:[NSDictionary class]])
    {
        return YES;
    }
    [SVProgressHUD showErrorWithStatus:@"数据有误"];
    return NO;
}

@end
